<?php

class IndexAction extends BaseAction
{
    
	/**
		定义空操作
	*/
	public function _empty()
	{
		
		$this->_pageNotFound();
	}
	
	/**
    +----------------------------------------------------------
    * 默认操作
    +----------------------------------------------------------
    */
    public function index()
    {

		$this->_getOrderDetail();//获取订单总数信息
		
		//输出上次访问信息
		$this->assign('last_login_ip',Session::get('last_login_ip'));
		$this->assign('last_login_time',Session::get('last_login_time'));

		$this->assign('nav', 'index');
		$this->display();
    }
	
	/**
		获取首页overview 订单详情 
		包含：订单总数、已确认订单数、为确认订单数、已取消订单数
		@access private
		
	*/
	protected function _getOrderDetail() 
	{
		$Order = M('order');
		$total_orders = $Order->count();
		$confirmed_orders = $Order->where('status=2')->count();
		$unconfirmed_orders = $Order->where('status=1')->count();
		$canceled_orders = $Order->where('status=3')->count();
		
		$this->assign('total_orders', $total_orders);
		$this->assign('confirmed_orders', $confirmed_orders);
		$this->assign('unconfirmed_orders', $unconfirmed_orders);
		$this->assign('canceled_orders', $canceled_orders);
		
		
	}


}
?>